import 'package:flutter_wan_android/core/storage/json_cache_storage.dart';
import 'package:flutter_wan_android/data/banner/banner_entity.dart';

class BannerLocalApi {
  static const _keyBanners = "cache_banners";


  Future<List<BannerEntity>> getList() async{
    var json = await JsonCacheStorage.readJson(_keyBanners);
    if (json is List){
      return json.map((item) => BannerEntity.fromJson(item)).toList();
    }
    return [];
  }


  void saveList(List<BannerEntity> list){
    JsonCacheStorage.saveJson(_keyBanners, list);
  }
}